/*
 * @Description: 
 * @Author: renmr
 * @Date: 2023-03-14 17:22:07
 */
'use strict'
// Template version: 1.3.1
const path = require('path')
//全文的ip代理处理设置，兼容多环境
const baseurl = require("./url.config.js");
// 处理多项目兼容ip访问代理
// 获取当前运行，打包的项目名称，环境等内容
const {PROJECT_NAME} = require('./engineeringConfig.js');
const proxyTable = {};
for (const key in baseurl) {
  proxyTable[key] = {
    target: baseurl[key],
    changeOrigin: true,
    ws: true,
    pathRewrite: {
      [`^${key}`]: "",
    },
  };
}
// https://blog.csdn.net/cs23405/article/details/109601124
module.exports = {
  dev: {
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: proxyTable,
    host: 'localhost',
    port: 8080, 
    autoOpenBrowser: false,
    errorOverlay: true,
    notifyOnErrors: true,
    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
    devtool: 'cheap-module-eval-source-map',
    cacheBusting: true,
    cssSourceMap: true
  },
  build: {
    // 配置打包以后的静态文件目录index.html的指向
    index: path.resolve(__dirname, `../dist/${PROJECT_NAME}/index.html`),
    // 配置打包静态文件输出目录
    assetsRoot: path.resolve(__dirname, `../dist/${PROJECT_NAME}`),
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    productionSourceMap: true,
    devtool: '#source-map',
    productionGzip: false,
    productionGzipExtensions: ['js', 'css'],
    bundleAnalyzerReport: process.env.npm_config_report
  }
}
